package com.djl.mymall.controller;

import com.djl.mymall.common.CommonResult;
import com.djl.mymall.service.MenberService;
import com.djl.mymall.service.RedisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author djl
 * @projectName myMall
 * @description: 验证码测试
 * @date 2022/1/181:09
 */
@Controller
@Api("测试验证码")
public class AuthCodeController {
    @Autowired
    private MenberService menberService;
    @ResponseBody
    @ApiOperation("获取验证码")
    @GetMapping("/getAuthCode/{tel}")
    public CommonResult getAuthCode(@PathVariable("tel") String tel){

        return menberService.generateAuthCode(tel);
    }

    @ResponseBody
    @ApiOperation("获取验证码")
    @GetMapping("/getAuthCode/{tel}/{authcode}")
    public CommonResult verifyAuthCode(@PathVariable("tel") String tel,@PathVariable("authcode") String authcode){
        return menberService.verifyAuthCode(tel,authcode);
    }


}
